This document provides instructions for downloading and installing R and RStudio on an Apple Macintosh machine.

NOTE: Because of backward dependency issues, some code that we talk about in class will NOT work if you do not download the latest version of R/RStudio. Because the class is pretty large, I will NOT be able to address issues due to older versions in class.

Before you start

  1. Check which version of Mac OS you have. To do this, click on the Apple icon on the top-left of your screen, then click “About This Mac”. A little window should pop up with version information.


  1. Make sure that you have about 500 MB of free space on your machine. We will need this space to install both R and RStudio, and when the program installs the compressed files expand to take much more space.

Installing R

  1. Go to this website.

  2. If your mac is OS X 10.11 and higher (this should be the case for most of you), click the R-3.6.1.pkg link. If your mac is OS X 10.9 or 10.10, click the R-3.3.3.pkg link.

  3. After clicking on the link, the file (package installer) will be downloaded onto your computer. Once the file has been downloaded, click on the link and walk through the installation process. Accept the default options for now.

R is now installed on your computer.

Testing R

  1. Double-click on the R icon in the Applications folder. A window titled “R Console” should pop up:


The > character is called the prompt and is the place where we enter commands for the program to interpret. For instance, if you type 25+26 followed by the return/enter key, you will see:

25+26
## [1] 51
  1. To quit R, call the quit function by typing q() and htting the return key.
q()

R will ask you if you want to save your work:


Click on “Don’t Save”. You have now left R.

We are not going to use R this way often, as we will use an integrated environment called RStudio.

Installing RStudio

  1. Go to this website.

  2. Under the “Installers for Supported Platforms” section, click on the “RStudio 1.2.5001 - macOS 10.12+ (64-bit)” link. The file download will begin. (If you are on a 32-bit system or need the 32-bit version of R, you need an older version of RStudio. Go to this website instead.)

  3. Once the file has been downloaded, click on it. A window should pop up:


Click on the RStudio icon and drag it into the Applications folder.

RStudio is now installed on your computer.

Note: For RStudio to work, R needs to be installed first.

Testing RStudio

  1. Double-click on the RStudio icon in the Applications. A window titled “RStudio” should pop up, looking something like this:

 

  1. Just as in R, the > character in the Console window is where we enter commands for the program to interpret.

  2. To exit RStudio, click “RStudio” in the menu bar, then click “Quit RStudio”. Alternatively, use the Cmd-Q shortcut. If prompted to save the workspace, do not save it.